﻿@{
    ViewBag.Title = "newindex";
}
@section scripts
{
    <script src="@Url.Content("~/Scripts/shared/share.js")" type="text/javascript"></script> 
    <script src="@Url.Content("~/Scripts/shared/shown.js")" type="text/javascript"></script>         
}

<form id="form1" method="post">
    <div class="mini-toolbar" style="padding:2px;border-top:0;border-left:0;border-right:0;">                
        <table style="width:100%;">
            <tr>
                <td style="white-space:nowrap;">
                    @Html.Partial("~/Views/Modular/SearchInfo.cshtml")
                </td>
                <td style="width:100%;">
                    <span class="separator"></span>
                    <a class="mini-button" iconCls="icon-ok" onclick="onSelectGoods" plain="true">选择</a>
                    <span class="separator"></span>
                        <a class="mini-button" iconCls="icon-close" onclick="CloseWindow" plain="true">关闭</a>
                </td>
            </tr>
        </table>                
    </div>
    <div id="datagrid1" class="mini-datagrid" style="width:100%;height:385px;" pageSize="5" idField="FItemID" 
        multiSelect="false"  allowCellSelect="true" allowCellEdit="true"
        borderStyle="border:0;" url="../Goods/GetSysGoodsList" fitColumns="false"  ondrawcell="DrawCell" onrowdblclick="onSelectOne">
        <div property="columns">
            <div type="checkcolumn"></div>                    
            <div field="FGoodsImg" name="FGoodsImg" width="120" headeralign="center" allowsort="true" style="font-size:12pt !important;">图片</div>                    
            <div field="FName" name="FName" width="200" headeralign="center" allowsort="true">商品名称</div>
            <div field="FCode" name="FCode" width="150" headeralign="center" allowsort="true">商品条码</div>
        </div>
    </div>  

    <script type="text/javascript">
        //通用shown自动调用些方式
        function FormShown() {
            mini.parse();
            search();
        }

        function setkeyPress() {
            if (event.keyCode == 13) {
                search();
            }
        }


        //加载用户列表
        function search() {
            var sSystemAppID = parent.window.getSystemAppID();
            var json = "[{";
            json = json + "'mDataType':" + "'1',";
            json = json + "'FClass':" + "'',";
            json = json + "'mSystemAppID':" + "'" + sSystemAppID + "',";
            json = json + "'search':" + "'" + mini.getbyName("FSearchKey").getValue() + "'";
            json = json + "}]";
            var grid = mini.get("datagrid1");
            grid.load({ json: json });
        }

        function onSelectGoods(e) {
            var grid = mini.get("datagrid1");
            var rec = grid.getSelecteds();
            if (rec) {
                CloseWindow(rec);
            }
        }

        function DrawCell(e) {
            if (e.columnIndex == 1) {
                var PicUrl = e.row.FGoodsImg;
                if (PicUrl == '') {
                    PicUrl = 'http://ct.posyun3721.com:7006/content/images/PImage.jpg';
                } else {
                    PicUrl = 'http://erp.pos08.com/' + PicUrl;
                }
                e.cellHtml = '<img src="' + PicUrl + '" width="80px" height="80px" />';
            }
        }

    </script>
</form>


